
Last chance! 50% off unlimited learning
Sale ends in
Take a bn
object or bn.fit
object encoding a Gaussian network
and refit all the local distributions using lm()
. This makes it
possible to use all the functions provided by R for lm
objects
(summary
, anova
, etc.) to investigate the network.
# S3 method for bn
as.lm(x, data, ...)
# S3 method for bn.fit
as.lm(x, data, ...)
# S3 method for bn.fit.gnode
as.lm(x, data, ...)
an object of class bn
, bn.fit
or bn.fit.gnode
.
a data frame containing the variables in the model.
additional arguments, currently ignored.
If x
is an object of class bn
or bn.fit
, as.lm()
returns a list of lm
objects, one for each node in x
. If
x
is an object of class bn
or bn.fit.gnode
,
as.lm()
returns a single lm
object.
# NOT RUN {
dag = hc(gaussian.test)
fitted = bn.fit(dag, gaussian.test)
as.lm(dag, gaussian.test)
as.lm(fitted, gaussian.test)
as.lm(fitted$F, gaussian.test)
# }
Run the code above in your browser using DataLab